package com.example.plugin_native.createFarm

import android.app.Activity
import android.view.LayoutInflater
import android.view.View
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import com.example.plugin_native.R
import com.example.plugin_native.databinding.DialogGuidebookBinding
import com.kongzue.dialogx.dialogs.CustomDialog
import com.kongzue.dialogx.interfaces.OnBindView

class ShowGuidebook {
    fun show(activity: Activity) {

        val guidebookModel = GuidebookModel()

        val binding = DataBindingUtil.inflate<DialogGuidebookBinding>(
            LayoutInflater.from(activity),
            R.layout.dialog_guidebook,
            null,
            false
        )
        binding.model = guidebookModel

        CustomDialog.show(object : OnBindView<CustomDialog>(binding.root) {
            override fun onBind(dialog: CustomDialog, v: View) {
                binding.btnClose.setOnClickListener {
                    dialog.dismiss()
                }
            }
        })
            .setCancelable(false)
            .setMaskColor(activity.resources.getColor(R.color.black40))
    }
}